/**
 * Created by ThinkPad User on 2021-04-13.
 */
exports.install = function (Vue) {
    Vue.prototype.$target = "http://39.100.7.70:81/";
    // Vue.prototype.$globalData = "testGlobalData";
    Vue.prototype.$globalData = {};
    Vue.prototype.$deepClone = function deepClone(obj = {}) {
        if (typeof obj !== 'object' || obj == null) {
            // obj 是 null ，或者不是对象和数组，直接返回
            return obj
        }

        // 初始化返回结果
        let result
        if (obj instanceof Array) {
            result = []
        } else {
            result = {}
        }

        for (let key in obj) {
            // 保证 key 不是原型的属性
            if (obj.hasOwnProperty(key)) {
                // 递归调用！！！
                result[key] = deepClone(obj[key])
            }
        }

        // 返回结果
        return result
    };

    Vue.prototype.$successNotify = function(msg){
        this.$notify({
            title: '成功',
            message: msg,
            type: 'success'
        });
    };

    Vue.prototype.$errorNotify = function(msg){
        this.$notify({
            title: '错误',
            message: msg,
            type: 'error'
        });
    }
};
// target = "http://39.100.7.70:81";